package utils

import (
	"io/ioutil"
	"log"
	"net/http"
	"strings"
)

func GetIp() (string, error) {
	res, err := http.Get("http://checkip.amazonaws.com")
	if err != nil {
		log.Fatalln("公网IP获取失败", err)
		return "", err
	}
	body, _ := ioutil.ReadAll(res.Body)
	return strings.Trim(string(body), "\n"), nil
}
